package com.example.weather.controller;

import com.example.weather.service.SearchService;
import com.example.weather.dto.WeatherResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class SearchController {
    @Autowired
    SearchService searchService;

    @RequestMapping(value = "/searchcity")
    @ResponseBody  //天气查询数据的json格式字符串
    public WeatherResponse searchcity(String cityid){

        WeatherResponse weatherResponse = searchService.searchWeather(cityid);
        System.out.println("查询结果：" + weatherResponse);

        return weatherResponse;

    }

}
